import { showModal } from "@tarojs/taro";
class Modal {
    constructor() {
    }
    alert(content, params) {
        var _a;
        params = params || {};
        showModal({
            content,
            title: (_a = params.title) !== null && _a !== void 0 ? _a : '提示',
            showCancel: false,
            success: (res) => {
                if (typeof (params === null || params === void 0 ? void 0 : params.callback) === "function")
                    params.callback(res);
            }
        })
            .then(() => {
        });
    }
    confirm(content, params) {
        var _a, _b, _c, _d, _e;
        params = params || {};
        showModal({
            content,
            title: (_a = params.title) !== null && _a !== void 0 ? _a : '提示',
            showCancel: typeof params.showCancel === 'boolean' ? params.showCancel : true,
            confirmText: (_b = params.confirmText) !== null && _b !== void 0 ? _b : '确认',
            confirmColor: (_c = params.confirmColor) !== null && _c !== void 0 ? _c : '#666',
            cancelText: (_d = params.cancelText) !== null && _d !== void 0 ? _d : '取消',
            cancelColor: (_e = params.cancelColor) !== null && _e !== void 0 ? _e : "#808080",
            success: (res) => {
                if (typeof (params === null || params === void 0 ? void 0 : params.callback) === "function")
                    params.callback(res);
            }
        })
            .then(() => {
        });
    }
    error(content, params) {
        showModal({
            title: '错误',
            content,
            showCancel: false,
            success: (res) => {
                if (typeof (params === null || params === void 0 ? void 0 : params.callback) === "function")
                    params.callback(res);
            }
        })
            .then(() => {
        });
    }
}
export default new Modal();
